<?php namespace Admin\Controller;
use Hdphp\Controller\Controller;
//网站配置控制器
class WebSetController extends CommonController{
     public function index(){
     	$model = new \Admin\Model\WebSet;
		if(IS_POST){
			//UPDATE webset SET value=40 WHERE name='CODE_LEN';
			foreach(Q('post.') as $k=>$v){
				$model ->where("name='{$k}'")->save(array('value' =>$v));
			}
			//写入配置项文件
			//可以写入定界符,数据合法化
			file_put_contents('./Config/webset.php', "<?php return " . var_export(Q('post.'),true) . ";");
			View::success('更改成功');
		}
     	$data = $model->get();
		View::with('data',$data);
         View::make();
     }

}































 ?>